This scripts aggregate the mixed effect models

Import

Load data

# d <- readRDS('E:/in_vivo_vr/sarah_glm_202006/time_model_data2plot.rds')

# Load a particular cohort
use_condaenv("glm_mec_model")
pd <- import("pandas")
pickle <-import("pickle")
cohort = c(2,3,4,5,7) # 2,3,4,5,7

#load all files
dfs = lst(n=5)
for (i in seq(5)){
  file <- glue("/mnt/datastore/Teris/CurrentBiology_2022/cohort", cohort[[i]], "_df4r.pkl")
  df <- pd$read_pickle(file)
  df <- as_tibble(df)
  dfs[[i]] = df
}
Warning in py_to_r.pandas.core.frame.DataFrame(result) :
  index contains duplicated values: row names not set
Warning in py_to_r.pandas.core.frame.DataFrame(result) :
  index contains duplicated values: row names not set
Warning in py_to_r.pandas.core.frame.DataFrame(result) :
  index contains duplicated values: row names not set
Warning in py_to_r.pandas.core.frame.DataFrame(result) :
  index contains duplicated values: row names not set
Warning in py_to_r.pandas.core.frame.DataFrame(result) :
  index contains duplicated values: row names not set
df_ramp = as_tibble(pd$read_pickle("/mnt/datastore/Teris/CurrentBiology_2022/all_rampscore.pkl"))
Warning in py_to_r.pandas.core.frame.DataFrame(result) :
  index contains duplicated values: row names not set

df <- bind_rows(dfs)


getFiringRate <- function(spiketrain){
  spiketrain[[1]]/100
}

lm_cls <- read_tsv('/mnt/datastore/Teris/CurrentBiology_2022/all_results_coefficients.csv')
Rows: 1456 Columns: 11
── Column specification ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Delimiter: "\t"
chr (6): session_id, unique_id, final_model_o_b, lm_group_b, lm_group_nb, lm_group_p
dbl (5): index, cluster_id, o_b_mod_coefs_pos, o_b_mod_coefs_speed, o_b_mod_coefs_accel

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
df_merged <- df %>% inner_join(lm_cls,by=c("session_id"="session_id","cluster_id"="cluster_id")) %>%
              inner_join(df_ramp, by=c("session_id"="session_id","cluster_id"="cluster_id")) %>%
      filter(ramp_region=="outbound", trial_type=="beaconed") 

# Extract the firing rate
df_merged <- df_merged %>%
  mutate(firingRate = map_dbl(spiketrain, getFiringRate)) %>%
  mutate(trial_length_type = recode(trial_length_type, `0` = "Short", `1` = "Middle", `2` = "Long")) 


included_sessions = unique(df$session_id)
df_merged
NA

Figure 5C

Extrapolate firing rate at reward zone

Normalize the firing rate

getMaxFr <- function(data) {
  max(data$firingRate)
}

# Get max firing rate of each cells
fr_max <- df_merged %>%
    group_by(session_id, cluster_id) %>%
  nest() %>%
  mutate(max_fr = map_dbl(data,getMaxFr)) %>%
  select(session_id, cluster_id, max_fr) 

norm_data <- function(data){
    data$firingRate <- data$firingRate/data$max_fr
    return(data)
}

# Match back to the original 

df_merged_norm <- df_merged %>%
  inner_join(fr_max, by=c("session_id","cluster_id")) 

df_merged_norm <- df_merged_norm %>%
    group_by(session_id, cluster_id, trial_length_type) %>%
   nest() %>%
    mutate(data_norm = map(data, norm_data))

df_merged_filt <- df_merged_norm %>% filter(session_id=='M1_D31_2018-11-01_12-28-25', cluster_id==7)
print(df_merged_filt)

Fit a linear model with time and compare with the firing rate at the reward zone to see if it matches the time model

time_model <- function(data){
#     print(names(data))
    tidy(lm(firingRate ~ time_relative_outbound, data=data))
}

predict_reward_firingRate <- function(intercept, slope, trial_time){
    slope*trial_time+intercept
}

find_reward_fringRate <- function(data){
    last(data$firingRate)
}

fitSlopePeak <- function(row){
    row %>% group_by(trial_number) %>%
    nest() %>%
    mutate(time_model = map(data, time_model)) %>%
    mutate(intercept=map_dbl(time_model, ~ .x[[1, 'estimate']])) %>% #get intercept
    mutate(slope = map_dbl(time_model, ~ .x[[2,'estimate']])) %>% #get slope
    mutate(trial_time = map_dbl(data, ~last(.x$time_relative_outbound))) %>%
    mutate(reward_fr = pmap_dbl(list(intercept,slope,trial_time),predict_reward_firingRate)) %>%
    mutate(final_reward_fr = map_dbl(data,find_reward_fringRate)) %>%
    group_by() %>%
    summarize(mean_intercept=mean(intercept), 
              mean_slope = mean(slope), 
              mean_reward_fr = mean(reward_fr),
             final_reward_fr = mean(final_reward_fr))
}

x2 <- df_merged_filt[1,]$data_norm[[1]]
fitSlopePeak(x2)
# get the predicted firing rate at the reward
data_merged_reward <- df_merged_norm %>% mutate(reward_fr_data = map(data_norm,possibly(fitSlopePeak,otherwise = NA))) %>%
    unnest_wider(reward_fr_data)
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 41: trial_number = 164.
Registered S3 method overwritten by 'data.table':
  method           from
  print.data.table     
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 9: trial_number = 53.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 28: trial_number = 353.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 18: trial_number = 291.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 20: trial_number = 301.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 17: trial_number = 267.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 13: trial_number = 235.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 19: trial_number = 297.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 2: trial_number = 30.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 17: trial_number = 267.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 19: trial_number = 297.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 7: trial_number = 117.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 10: trial_number = 139.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 32: trial_number = 187.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 36: trial_number = 208.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 32: trial_number = 187.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 46: trial_number = 244.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 42: trial_number = 249.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 16: trial_number = 124.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 11: trial_number = 115.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 11: trial_number = 115.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 6: trial_number = 21.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 6: trial_number = 21.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 3: trial_number = 54.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 16: trial_number = 142.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 3: trial_number = 54.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 14: trial_number = 93.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 33: trial_number = 180.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 35: trial_number = 193.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 30: trial_number = 75.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 5: trial_number = 18.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 21: trial_number = 46.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 34: trial_number = 121.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 3: trial_number = 23.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 3: trial_number = 7.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 15: trial_number = 61.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 9: trial_number = 35.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 23: trial_number = 100.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 30: trial_number = 125.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 31: trial_number = 98.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 52: trial_number = 268.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 24: trial_number = 73.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 29: trial_number = 93.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 13: trial_number = 35.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 24: trial_number = 73.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 27: trial_number = 55.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 65: trial_number = 231.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 20: trial_number = 40.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 38: trial_number = 104.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 60: trial_number = 200.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 70: trial_number = 250.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 85: trial_number = 355.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 70: trial_number = 250.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 84: trial_number = 349.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 27: trial_number = 55.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 72: trial_number = 256.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 1: trial_number = 3.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 62: trial_number = 206.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 44: trial_number = 186.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 9: trial_number = 38.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 50: trial_number = 221.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 9: trial_number = 38.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 50: trial_number = 221.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 19: trial_number = 207.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 5: trial_number = 60.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 3: trial_number = 54.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 44: trial_number = 251.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 8: trial_number = 31.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 57: trial_number = 304.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 8: trial_number = 31.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 12: trial_number = 49.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 57: trial_number = 304.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 60: trial_number = 337.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 57: trial_number = 304.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 14: trial_number = 58.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 22: trial_number = 156.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 20: trial_number = 82.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 60: trial_number = 328.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 20: trial_number = 82.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 12: trial_number = 66.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 18: trial_number = 78.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 43: trial_number = 193.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 2: trial_number = 9.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 33: trial_number = 313.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 25: trial_number = 163.
Warning: Problem while computing `reward_fr_data = map(data_norm, possibly(fitSlopePeak, otherwise = NA))`.
ℹ essentially perfect fit: summary may be unreliable
ℹ The warning occurred in group 91: trial_number = 466.
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1
New names:
* `` -> ...1

getLMcls <- function(data){
  data$lm_group_b[[1]]
}

data2plot <- data_merged_reward %>%
    filter(trial_length_type %in% c('Long','Short')) 
data2plot$trial_length_type <- factor(data2plot$trial_length_type, levels=c('Long','Short'))
data2plot <- data2plot %>% mutate(cell_id = glue("{session_id}_{cluster_id}")) %>%
    mutate(lm_group_b = map_chr(data, getLMcls))
# Simplify data for analysis
data_merged_reward_sel <- data2plot %>%
    select(-data_norm, -data)

saveRDS(data_merged_reward_sel,'/mnt/datastore/Teris/CurrentBiology_2022/S5C_data2plot.rds', compress = FALSE)
# print(data_merged_reward_sel,n=3,width=300)
# options(repr.plot.width=8, repr.plot.height=15)

comp = list(c('Long','Short'))

p1 <- ggboxplot(data2plot, y='final_reward_fr',
          x='trial_length_type',facet.by='lm_group_b', id = 'cell_id',
          nrow=1, scales='free', xlab='Trial length', ylab='Intercept',
              fill = "trial_length_type") +
            labs(fill="Trial length") +
    stat_compare_means(comparisons=comp,label = "p.signif",vjust=0.2, paired= TRUE, method='wilcox.test') +
    theme_minimal(base_size=15)+
    theme(panel.grid.major = element_blank(),panel.grid.minor = element_blank(),axis.line = element_line())


p2 <- ggboxplot(data2plot, y='mean_slope',
               fill = "trial_length_type",
          x='trial_length_type',facet.by='lm_group_b',
               nrow=1,scales='free',xlab='Trial length', 
               ylab='Slope',id='cell_id') +
          labs(fill="Trial length") +
    stat_compare_means(comparisons=comp,label = "p.signif", paired= TRUE, vjust=0.2, method='wilcox.test') +
        theme_minimal(base_size=15)+
        theme(panel.grid.major = element_blank(),panel.grid.minor = element_blank(),axis.line = element_line())


p1 / p2
Warning: Removed 30 rows containing non-finite values (stat_boxplot).
Warning: Removed 30 rows containing non-finite values (stat_signif).
Warning: Removed 30 rows containing non-finite values (stat_boxplot).
Warning: Removed 30 rows containing non-finite values (stat_signif).

ggsave('paper_figures/S5C.pdf',width=12,height=8)
Warning: Removed 30 rows containing non-finite values (stat_boxplot).
Warning: Removed 30 rows containing non-finite values (stat_signif).
Warning: Removed 30 rows containing non-finite values (stat_boxplot).
Warning: Removed 30 rows containing non-finite values (stat_signif).
# ggboxplot(data2plot, y='mean_slope',color='trial_length_type',x='lm_result_outbound')
p1 <- ggboxplot(data2plot, y='final_reward_fr',
          x='trial_length_type',facet.by='lm_group_b', id = 'cell_id',
          nrow=1, scales='free', xlab='Trial length', ylab='Intercept',
              fill = "trial_length_type") +
            labs(fill="Trial length") +
    stat_compare_means(comparisons=comp,label = "p.format",vjust=0.2, paired= TRUE, method='wilcox.test') +
    theme_minimal(base_size=15)+
    theme(panel.grid.major = element_blank(),panel.grid.minor = element_blank(),axis.line = element_line())
LS0tCnRpdGxlOiAiUiBOb3RlYm9vayIKb3V0cHV0OgogIGh0bWxfbm90ZWJvb2s6CiAgICBkZl9wcmludDogcGFnZWQKICAgIHRvYzogeWVzCiAgICB0b2NfZmxvYXQ6IHllcwogIGh0bWxfZG9jdW1lbnQ6CiAgICB0b2M6IHllcwogICAgZGZfcHJpbnQ6IHBhZ2VkCi0tLQoKVGhpcyBzY3JpcHRzIGFnZ3JlZ2F0ZSB0aGUgbWl4ZWQgZWZmZWN0IG1vZGVscwoKCiMjIyBJbXBvcnQKCgpgYGB7ciBpbmNsdWRlPUZBTFNFLCBtZXNzYWdlPUZBTFNFfQpsaWJyYXJ5KHJzdGF0aXgpCmxpYnJhcnkoZmVhdGhlcikKbGlicmFyeSh0aWR5dmVyc2UpCmxpYnJhcnkocmpzb24pCmxpYnJhcnkobG1lNCkKbGlicmFyeShyZXRpY3VsYXRlKQpsaWJyYXJ5KGdnZWZmZWN0cykKbGlicmFyeShicm9vbSkKbGlicmFyeShnbHVlKQpsaWJyYXJ5KHByb2dyZXNzKQpsaWJyYXJ5KGdnZm9yY2UpCmxpYnJhcnkocGF0Y2h3b3JrKQpsaWJyYXJ5KGdncHVicikKCiMga25pdHI6Om9wdHNfY2h1bmskc2V0KAojICAgZmlnLnNob3cgPSAiaG9sZCIsCiMgICBmaWcud2lkdGggPSA3LAojICAgZmlnLmFzcCA9IDAuNgojICkKCmBgYAoKIyMjIExvYWQgZGF0YQoKYGBge3J9CiMgZCA8LSByZWFkUkRTKCdFOi9pbl92aXZvX3ZyL3NhcmFoX2dsbV8yMDIwMDYvdGltZV9tb2RlbF9kYXRhMnBsb3QucmRzJykKCiMgTG9hZCBhIHBhcnRpY3VsYXIgY29ob3J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